package com.yb.core.util;

import org.springframework.core.io.Resource;

import java.io.IOException;
import java.io.InputStream;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/5/9 13:38
 * FileName: IOUtils
 * Description:
 */
public class IOUtil {
    public static String toString(InputStream is){
        return "";
    }


    public static String toString(Resource resource){
        InputStream is = null;
        String result="";
        try {
             is = resource.getInputStream();
            byte[] bytes = new byte[is.available()];
            is.read(bytes);
            result=new String(bytes);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        return result;
    }
}
